<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets the object's ratio</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="swfdisplayitem.setname.html">SWFDisplayItem::setName</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="swfdisplayitem.skewx.html">SWFDisplayItem::skewX</a></div>
 <div class="up"><a href="class.swfdisplayitem.html">SWFDisplayItem</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="swfdisplayitem.setratio" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SWFDisplayItem::setRatio</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.5)</p><p class="refpurpose"><span class="refname">SWFDisplayItem::setRatio</span> &mdash; <span class="dc-title">Sets the object&#039;s ratio</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-swfdisplayitem.setratio-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>SWFDisplayItem::setRatio</strong></span>
    ( <span class="methodparam"><span class="type">float</span> <code class="parameter">$ratio</code></span>
   )</div>

  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">此函数是<em class="emphasis">实验性</em>的。此函数的表象，包括名称及其相关文档都可能在未来的
PHP 发布版本中未通知就被修改。使用本函数风险自担 。</p></div>
  <p class="para">
   <span class="function"><strong>swfdisplayitem::setratio()</strong></span> sets the object&#039;s ratio
   to <em><code class="parameter">ratio</code></em>. Obviously only useful for morphs. 
  </p>
  <p class="simpara">
   The object may be a <span class="function"><strong>swfshape()</strong></span>, a 
   <span class="function"><strong>swfbutton()</strong></span>, a <span class="function"><strong>swftext()</strong></span> or a 
   <span class="function"><strong>swfsprite()</strong></span> object. It must have been added using
   the <span class="function"><a href="swfmovie.add.html" class="function">swfmovie::add()</a></span>.
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-swfdisplayitem.setratio-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-swfdisplayitem.setratio-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   This simple example will morph nicely three concentric circles.
   <div class="example" id="example-3454">
    <p><strong>Example #1 <span class="function"><a href="swfdisplayitem.setname.html" class="function">swfdisplayitem::setname()</a></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$p&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SWFMorph</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$g&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SWFGradient</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.16</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.32</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.48</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.64</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.80</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">1.00</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getShape1</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$f&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addFill</span><span style="color: #007700">(</span><span style="color: #0000BB">$g</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SWFFILL_RADIAL_GRADIENT</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$f</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">scaleTo</span><span style="color: #007700">(</span><span style="color: #0000BB">0.05</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setLeftFill</span><span style="color: #007700">(</span><span style="color: #0000BB">$f</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">movePenTo</span><span style="color: #007700">(-</span><span style="color: #0000BB">160</span><span style="color: #007700">,&nbsp;-</span><span style="color: #0000BB">120</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drawLine</span><span style="color: #007700">(</span><span style="color: #0000BB">320</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drawLine</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">240</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drawLine</span><span style="color: #007700">(-</span><span style="color: #0000BB">320</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drawLine</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;-</span><span style="color: #0000BB">240</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$g&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SWFGradient</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.16</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.32</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.48</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.64</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">0.80</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$g</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addEntry</span><span style="color: #007700">(</span><span style="color: #0000BB">1.00</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getShape2</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$f&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addFill</span><span style="color: #007700">(</span><span style="color: #0000BB">$g</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SWFFILL_RADIAL_GRADIENT</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$f</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">scaleTo</span><span style="color: #007700">(</span><span style="color: #0000BB">0.05</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$f</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">skewXTo</span><span style="color: #007700">(</span><span style="color: #0000BB">1.0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setLeftFill</span><span style="color: #007700">(</span><span style="color: #0000BB">$f</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">movePenTo</span><span style="color: #007700">(-</span><span style="color: #0000BB">160</span><span style="color: #007700">,&nbsp;-</span><span style="color: #0000BB">120</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drawLine</span><span style="color: #007700">(</span><span style="color: #0000BB">320</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drawLine</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">240</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drawLine</span><span style="color: #007700">(-</span><span style="color: #0000BB">320</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">drawLine</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;-</span><span style="color: #0000BB">240</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SWFMovie</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setDimension</span><span style="color: #007700">(</span><span style="color: #0000BB">320</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">240</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">(</span><span style="color: #0000BB">$p</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">moveTo</span><span style="color: #007700">(</span><span style="color: #0000BB">160</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">120</span><span style="color: #007700">);<br /><br />for&nbsp;(</span><span style="color: #0000BB">$n</span><span style="color: #007700">=</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$n</span><span style="color: #007700">&lt;=</span><span style="color: #0000BB">1.001</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$n</span><span style="color: #007700">+=</span><span style="color: #0000BB">0.01</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setRatio</span><span style="color: #007700">(</span><span style="color: #0000BB">$n</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">nextFrame</span><span style="color: #007700">();<br />}<br /><br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type:&nbsp;application/x-shockwave-flash'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">output</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="swfdisplayitem.setname.html">SWFDisplayItem::setName</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="swfdisplayitem.skewx.html">SWFDisplayItem::skewX</a></div>
 <div class="up"><a href="class.swfdisplayitem.html">SWFDisplayItem</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
